﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var baotypeData = Jxstar.findComboData('baotype');
	var planyearData = Jxstar.findComboData('planyear');
	var planstatusData = Jxstar.findComboData('planstatus');
	var moneytypeData = Jxstar.findComboData('moneytype');
	var plantypeData = Jxstar.findComboData('plantype');
	var planstatus2Data = Jxstar.findComboData('planstatus2');
	var plantype2Data = Jxstar.findComboData('plantype2');
	var authtypeData = Jxstar.findComboData('authtype');
	var projectjdData = Jxstar.findComboData('projectjd');
	var yesnoData = Jxstar.findComboData('yesno');
	var auditData = Jxstar.findComboData('audit');
	var resulttypeData = Jxstar.findComboData('resulttype');
	var checkdeptData = Jxstar.findComboData('checkdept');

	var cols = [
	{col:{header:'计划包属性', width:28, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: baotypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: baotypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < baotypeData.length; i++) {
				if (baotypeData[i][0] == value)
					return baotypeData[i][1];
			}
		}}, field:{name:'money_plan__bao_type',type:'string'}},
	{col:{header:'预算年度', width:69, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: planyearData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: planyearData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < planyearData.length; i++) {
				if (planyearData[i][0] == value)
					return planyearData[i][1];
			}
		}}, field:{name:'money_plan__plan_year',type:'string'}},
	{col:{header:'计划状态', width:75, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: planstatusData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: planstatusData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < planstatusData.length; i++) {
				if (planstatusData[i][0] == value)
					return planstatusData[i][1];
			}
		}}, field:{name:'money_plan__plan_status',type:'string'}},
	{col:{header:'项目名称', width:212, sortable:true}, field:{name:'money_plan__plan_name',type:'string'}},
	{col:{header:'投资内容与申请理由', width:263, sortable:true, hidden:true}, field:{name:'money_plan__plan_desc',type:'string'}},
	{col:{header:'项目类别', width:111, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: moneytypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: moneytypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < moneytypeData.length; i++) {
				if (moneytypeData[i][0] == value)
					return moneytypeData[i][1];
			}
		}}, field:{name:'money_plan__money_type',type:'string'}},
	{col:{header:'计划类型', width:68, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: plantypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: plantypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < plantypeData.length; i++) {
				if (plantypeData[i][0] == value)
					return plantypeData[i][1];
			}
		}}, field:{name:'money_plan__plan_type',type:'string'}},
	{col:{header:'预计总投资(万元)', width:122, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__plan_money',type:'float'}},
	{col:{header:'当年预计付款(万元)', width:121, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__year_money',type:'float'}},
	{col:{header:'项目状态', width:74, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: planstatus2Data
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: planstatus2Data[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < planstatus2Data.length; i++) {
				if (planstatus2Data[i][0] == value)
					return planstatus2Data[i][1];
			}
		}}, field:{name:'money_plan__plan_status2',type:'string'}},
	{col:{header:'国家局项目类别', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: plantype2Data
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: plantype2Data[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < plantype2Data.length; i++) {
				if (plantype2Data[i][0] == value)
					return plantype2Data[i][1];
			}
		}}, field:{name:'money_plan__money_type2',type:'string'}},
	{col:{header:'国家局批复金额(万元)', width:134, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__check_money2',type:'float'}},
	{col:{header:'数量', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(2)}, field:{name:'money_plan__plan_num',type:'float'}},
	{col:{header:'单位', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_unit',type:'string'}},
	{col:{header:'单价(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__plan_price',type:'float'}},
	{col:{header:'拟选供应商', width:100, sortable:true, hidden:true}, field:{name:'money_plan__provider',type:'string'}},
	{col:{header:'预计实施时间', width:102, sortable:true, hidden:true}, field:{name:'money_plan__plan_period',type:'string'}},
	{col:{header:'立项批复金额(万元)', width:129, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__project_money',type:'float'}},
	{col:{header:'合同金额(万元)', width:100, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__money_contract',type:'float'}},
	{col:{header:'已付款金额(万元)', width:120, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__money_pay',type:'float'}},
	{col:{header:'授权形式', width:79, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < authtypeData.length; i++) {
				if (authtypeData[i][0] == value)
					return authtypeData[i][1];
			}
		}}, field:{name:'money_plan__auth_type',type:'string'}},
	{col:{header:'主管部门', width:100, sortable:true, hidden:true}, field:{name:'money_plan__done_deptname',type:'string'}},
	{col:{header:'项目编号', width:100, sortable:true, hidden:true}, field:{name:'money_plan__project_code',type:'string'}},
	{col:{header:'决算审计金额(万元)', width:121, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__cost_money',type:'float'}},
	{col:{header:'投资计划批复文号', width:125, sortable:true}, field:{name:'money_plan__check_fileno',type:'string'}},
	{col:{header:'立项批复文号', width:100, sortable:true}, field:{name:'money_plan__project_fileno',type:'string'}},
	{col:{header:'当前形象进度', width:103, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: projectjdData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: projectjdData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < projectjdData.length; i++) {
				if (projectjdData[i][0] == value)
					return projectjdData[i][1];
			}
		}}, field:{name:'money_plan__project_process',type:'string'}},
	{col:{header:'申报部门', width:122, sortable:true}, field:{name:'money_plan__dept_name',type:'string'}},
	{col:{header:'是否结转', width:64, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: yesnoData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: yesnoData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < yesnoData.length; i++) {
				if (yesnoData[i][0] == value)
					return yesnoData[i][1];
			}
		}}, field:{name:'money_plan__is_turn',type:'string'}},
	{col:{header:'计划编号', width:107, sortable:true}, field:{name:'money_plan__plan_code',type:'string'}},
	{col:{header:'申报日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__plan_date',type:'date'}},
	{col:{header:'申报人', width:61, sortable:true, hidden:true}, field:{name:'money_plan__plan_user',type:'string'}},
	{col:{header:'记录状态', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'money_plan__auditing',type:'string'}},
	{col:{header:'备注', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_memo',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_id',type:'string'}},
	{col:{header:'申报人ID', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_userid',type:'string'}},
	{col:{header:'申报部门ID', width:100, sortable:true, hidden:true}, field:{name:'money_plan__dept_id',type:'string'}},
	{col:{header:'授权时间', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__auth_date',type:'date'}},
	{col:{header:'主管部门ID', width:100, sortable:true, hidden:true}, field:{name:'money_plan__done_deptid',type:'string'}},
	{col:{header:'计划批复金额(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__check_money',type:'float'}},
	{col:{header:'父计划编号', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_parentcode',type:'string'}},
	{col:{header:'型号规格', width:100, sortable:true, hidden:true}, field:{name:'money_plan__device_size',type:'string'}},
	{col:{header:'生产厂家', width:100, sortable:true, hidden:true}, field:{name:'money_plan__create_factory',type:'string'}},
	{col:{header:'固定资产编号', width:100, sortable:true, hidden:true}, field:{name:'money_plan__asset_code',type:'string'}},
	{col:{header:'出厂日期', width:100, sortable:true, hidden:true}, field:{name:'money_plan__create_date',type:'string'}},
	{col:{header:'上报金额(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__app_money',type:'float'}},
	{col:{header:'是否上报国家局', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < yesnoData.length; i++) {
				if (yesnoData[i][0] == value)
					return yesnoData[i][1];
			}
		}}, field:{name:'money_plan__up_comp',type:'string'}},
	{col:{header:'提交备案时间', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__up_sdate',type:'date'}},
	{col:{header:'备案下达时间', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__up_edate',type:'date'}},
	{col:{header:'备案结果', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < resulttypeData.length; i++) {
				if (resulttypeData[i][0] == value)
					return resulttypeData[i][1];
			}
		}}, field:{name:'money_plan__up_result',type:'string'}},
	{col:{header:'调概后批复金额(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__check_moneychk',type:'float'}},
	{col:{header:'投资计划批文名称', width:100, sortable:true, hidden:true}, field:{name:'money_plan__check_name',type:'string'}},
	{col:{header:'立项批文名称', width:100, sortable:true, hidden:true}, field:{name:'money_plan__project_checkname',type:'string'}},
	{col:{header:'国家局项目编号', width:100, sortable:true}, field:{name:'money_plan__plan_code2',type:'string'}},
	{col:{header:'国家局批复年度投资(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__year_money2',type:'float'}},
	{col:{header:'项目审批权限', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < checkdeptData.length; i++) {
				if (checkdeptData[i][0] == value)
					return checkdeptData[i][1];
			}
		}}, field:{name:'money_plan__check_right2',type:'string'}},
	{col:{header:'结转日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__tran_date',type:'date'}},
	{col:{header:'是否实施包', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < yesnoData.length; i++) {
				if (yesnoData[i][0] == value)
					return yesnoData[i][1];
			}
		}}, field:{name:'money_plan__is_dobao',type:'string'}},
	{col:{header:'父计划ID', width:100, sortable:true, hidden:true}, field:{name:'money_plan__plan_parentid',type:'string'}},
	{col:{header:'项目id', width:100, sortable:true, hidden:true}, field:{name:'money_plan__project_id',type:'string'}},
	{col:{header:'年度项目实施内容', width:100, sortable:true, hidden:true}, field:{name:'money_plan__year_content2',type:'string'}},
	{col:{header:'立项批复日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'money_plan__project_checkdate',type:'date'}},
	{col:{header:'计划批复年度付款(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__check_yearmoney',type:'float'}},
	{col:{header:'上报年度付款(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__app_yearmoney',type:'float'}},
	{col:{header:'开工日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'money_plan__project_sdate',type:'date'}},
	{col:{header:'竣工日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'money_plan__project_edate',type:'date'}},
	{col:{header:'截止上年底累计付款(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'money_plan__sun_money1',type:'float'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '0',
		isshow: '0',
		funid: 'money_query_gj'
	};
	
	//定义包标志列	cols[0].col.header = '';	cols[0].col.width = 28;	cols[0].col.renderer = function(val, meta, rec) {		var html = '';		var parentId = rec.get('money_plan__plan_id');		var baotype = rec.get('money_plan__bao_type');		var isturn = rec.get('money_plan__is_turn');		var imgname = 'folder' + baotype + '.gif';		if (baotype == '1' || baotype == '2') {			html = '<img src="resources/images/exp/'+ imgname +'" style="cursor:pointer;" title="点击查看子计划" '+				   'onClick="JxPm.showSubPlan(\''+ parentId +'\', \'money_bao_sub\', \''+ isturn +'\', \'money_query_gj\');"></img>';		}		return html;	};	config.eventcfg = {		pattach: function() {			var records = this.grid.getSelectionModel().getSelections();			if (!JxUtil.selectone(records)) return;						var self = this;			var keyid = records[0].get('money_plan__plan_id');						var params = 'planid=' + keyid + '&funid=money_query';			params += '&pagetype=grid&eventcode=pattach';			//发送请求，取相关附件ID			Request.postRequest(params, function(data){JxPm.showAttach(data, 'money_query_gj', keyid);});		}	};		config.initpage = function(gridNode) {		var grid = gridNode.page;		var event = gridNode.event;		event.on('beforecustom', function(ge) {			var records = ge.grid.getSelectionModel().getSelections();			if (!JxUtil.selectone(records)) return false;					var plan_status = records[0].get('money_plan__plan_status');			if (plan_status != '42') {				JxHint.alert('选择的投资计划不是实施中，不能执行该操作！');					return false;			}		});	};
		
	return new Jxstar.GridNode(config);
}